package org.tmad.ocms.mail;

import java.util.Map;

import org.apache.commons.lang3.text.StrSubstitutor;

public class EmailTemplates {
	
	private static String registrationTemplate ="Dear ${firstName}, \n Your  registration with "+
	"ocms application is complete. \n Here are your login details:\n"+
	"userName:  ${userName} \n" +
	"Password:  ${password} \n" +
	"Thank you for registering with our site, Please login and starting using our website\n"+
	"Regards, \n"+
	"Administrator\n"+
	"ocms\n"+
	"India\n" +
	"http://localhost:8080/ocms";	
	
	private static String forgotPasswordTemplate ="Dear ${firstName}, \n We have received your forgot password request." +
			"Please click the link below to reset your password \n"+
			"http://localhost:8080/ocms/active.jsp?email=${email}&activationCode=${activationCode}"+
			"\nRegards, \n"+
			"Administrator\n"+
			"ocms\n"+
			"India\n" +
			"http://localhost:8080/ocms";
	private static String caseregistrationTemplate ="Dear ${userName}, \n Your  registration with "+
			"ocms application is complete. \n Here are your login details:\n"+
			"caseType: ${caseType} \n"+
			"helpType: ${helpType \n"+
			"needyName:  ${needyName} \n" +
			"description: ${description} \n"+
			"address: ${address} \n"+
			"emailId:  ${emailId} \n" +
			"Thank you for registering with our site, Please login and starting using our website\n"+
			"Regards, \n"+
			"Administrator\n"+
			"ocms\n"+
			"India\n" +
			"http://localhost:8080/ocms";

	public static String caseType="caseType";

	public static String description="description";

	
    
	public static String needyName="needyName";

	public static String emailId="emailId";


	

	public static String helpType="helpType";

	public static String address="address";
	public static String email="email";

	public static String summary="summary"; 

	
	

	
	public static final String firstName ="firstName";
	public static final String userName="userName";
	public static final String password ="password";
	public static final String activationCode ="activationCode";

	
	
	public static String getEmailMessage(Template template, Map<String,String> valuesMap){
		
		
		StrSubstitutor sub = new StrSubstitutor(valuesMap);
		String resolvedString =null;
		switch(template){
		case Registration:
			resolvedString = sub.replace(registrationTemplate);
			break;
		case ForgotPassword:
			resolvedString = sub.replace(forgotPasswordTemplate);
			break;
		case CaseRegistration:
			resolvedString = sub.replace(caseregistrationTemplate);
			break;
		default:
			//Unsupported template
		}
		 		
		return resolvedString;
		
	}

}
